package cn.lingyangwl.agile.system.model.mq;

import cn.lingyangwl.agile.model.module.mq.AbstractMQ;
import cn.lingyangwl.agile.model.module.mq.BaseMqPayload;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

/**
 * 定义MQ消息格式
 * 业务场景： 更新租户
 *
 * @author shenguangyang
 */
@Getter
@Setter
public class TenantUpdateMQ extends AbstractMQ {
    public static final String QUEUE = "tenant.update";
    public static final String EXCHANGE = "system.tenant.update";
    public static final String KEY = "";

    public TenantUpdateMQ(MsgPayload msgPayload) {
        super(msgPayload);
    }

    /**
     * 定义Msg消息载体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class MsgPayload extends BaseMqPayload {
        /**
         * 租户套餐
         */
        private Long packageId;

        /**
         * 租户域名
         */
        private String domain;

        public MsgPayload(String tenantId, Long packageId, String domain) {
            super();
            this.tenantId = tenantId;
            this.packageId = packageId;
            this.domain = domain;
        }
    }

    public static TenantUpdateMQ build(String tenantId, Long packageId, String domain) {
        return new TenantUpdateMQ(new MsgPayload(tenantId, packageId, domain));
    }
}
